package com.tonghe.controller;

import com.tonghe.domain.ResponseResult;
import com.tonghe.domain.dto.EditDemandDTO;
import com.tonghe.domain.entity.Demand;
import org.springframework.web.bind.annotation.*;
import com.tonghe.service.DemandService;

import javax.annotation.Resource;

/**
 * (Demand)表控制层
 *
 * @author makejava
 * @since 2022-09-09 18:46:53
 */
@RestController
@RequestMapping("/recruitment/demand")
public class DemandController{

    @Resource
    private DemandService demandService;

    /** 查询公司需求 */
    @GetMapping("/{id}")
    public ResponseResult selectByRecruitmentId(@PathVariable Integer id) {
        return demandService.selectByRecruitmentId(id);
    }

    /** 获取树形结构 */
    @GetMapping("")
    public ResponseResult selectTreeDemand() {
        return demandService.selectTreeDemand();
    }

    /** 新增数据 */
    @PostMapping
    public ResponseResult insert(@RequestBody EditDemandDTO editDemandDTO) {
        return demandService.insertDemand(editDemandDTO);
    }

    /**
     * 修改数据
     *
     * @param demand 实体对象
     * @return 修改结果
     */
//    @PutMapping
//    public ResponseResult update(@RequestBody Demand demand) {
//        return success(this.demandService.updateById(demand));
//    }

    /**
     * 删除数据
     *
     * @param idList 主键结合
     * @return 删除结果
     */
//    @DeleteMapping
//    public ResponseResult delete(@RequestParam("idList") List<Long> idList) {
//        return success(this.demandService.removeByIds(idList));
//    }
}

